
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <meta name="google" value="notranslate">
    <style>
      html, body {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
        font-size: 14px;
        color: #333;
        background-color: #fff;
        overflow: hidden;
        text-align: center;
        padding-top: 50px;
        box-sizing: border-box;
      }
      a {
        display: inline-block;
        padding: 10px 20px;
        font-size: 26px;
        color: #337ab7;
      }
      a:hover {
        color: #23527c;
      }
    </style>
  </head>
  <body style="overscroll-behavior-x: none;">
    <a id="clientUrl" href="whistle://client">Open Whistle Client</a>
    <p>
      <a href="/cgi-bin/rootca">Download RootCA</a>
    </p>
    <script>
      var IMPORT_URL_RE = /[?&#]data(?:_url|Url)=([^&#]+)(?:&|#|$)/;
      function getDataUrl() {
        var result = IMPORT_URL_RE.exec(location.href);
        return result && result[1];
      }
      function isHttp(url) {
        try {
          url = decodeURIComponent(url).trim();
          return /https?:\/\/\S/.test(url);
        } catch (e) {}
      }
      var url = getDataUrl();
      if (isHttp(url)) {
        url = 'whistle://client?dataUrl=' + url;
        location.href = url;
        document.querySelector('#clientUrl').href = url;
      } else {
        location.href = 'whistle://client';
      }
    </script>
  </body>
</html>
